home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / bin / update-manager < prev    next >
Encoding:
Text File  |  2007-05-02  |  3.4 KB  |  92 lines

  1. #!/usr/bin/python2.5
  2. # update-manager.in - easy updating application
  3. #  
  4. #  Copyright (c) 2004 Canonical
  5. #                2004 Michiel Sikkes
  6. #  
  7. #  Author: Michiel Sikkes <michiel@eyesopened.nl>
  8. #          Michael Vogt <mvo@debian.org>
  9. #  This program is free software; you can redistribute it and/or 
  10. #  modify it under the terms of the GNU General Public License as 
  11. #  published by the Free Software Foundation; either version 2 of the
  12. #  License, or (at your option) any later version.
  13. #  This program is distributed in the hope that it will be useful,
  14. #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. #  GNU General Public License for more details.
  17. #  You should have received a copy of the GNU General Public License
  18. #  along with this program; if not, write to the Free Software
  19. #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  20. #  USA
  21.  
  22. import pygtk
  23. import os
  24. pygtk.require('2.0')
  25. import gtk
  26. import gtk.glade
  27. import sys
  28.  
  29. from UpdateManager.UpdateManager import UpdateManager
  30. import gettext
  31. from gettext import gettext as _
  32.  
  33. from optparse import OptionParser
  34.  
  35. if __name__ == "__main__":
  36.   APP="update-manager"
  37.   DIR="/usr/share/locale"
  38.  
  39.   gettext.bindtextdomain(APP, DIR)
  40.   gettext.textdomain(APP)
  41.   gtk.glade.bindtextdomain(APP, DIR)
  42.   gtk.glade.textdomain(APP)
  43.  
  44.   # Begin parsing of options
  45.   parser = OptionParser()
  46.   parser.add_option ("-c", "--check-dist-upgrades", action="store_true",
  47.                      dest="check_dist_upgrades", default=False,
  48.                      help=_("Check if a new distribution release is available"))
  49.   parser.add_option ("-d", "--devel-release", action="store_true",
  50.                      dest="devel_release", default=False,
  51.                      help=_("Check if upgrading to the latest devel release "
  52.                           "is possible"))
  53.   parser.add_option ("-p","--proposed", action="store_true",
  54.                      dest="use_proposed", default=False,
  55.                      help=_("Try to run a dist-upgrade"))
  56.   parser.add_option ("--dist-upgrade","--dist-ugprade", action="store_true",
  57.                      dest="dist_upgrade", default=False,
  58.                      help=_("Try to run a dist-upgrade"))
  59.  
  60.   (options, args) = parser.parse_args()
  61.  
  62.   data_dir="/usr/share/update-manager/"
  63.   #data_dir="/tmp/xxx/share/update-manager/"
  64.  
  65.   if options.dist_upgrade == True:
  66.     from DistUpgrade.DistUpgradeView import STEP_PREPARE, STEP_MODIFY_SOURCES, STEP_FETCH_INSTALL, STEP_CLEANUP, STEP_REBOOT
  67.     from DistUpgrade.DistUpgradeViewGtk import DistUpgradeViewGtk
  68.     from DistUpgrade.DistUpgradeControler import DistUpgradeControler
  69.     # FIXME: we *really* want to different view here
  70.     view = DistUpgradeViewGtk(data_dir)
  71.     view.label_title.set_markup("<b><big>%s</big></b>" % _("Running partial upgrade"))
  72.     view.setStep(STEP_PREPARE)
  73.     view.hideStep(STEP_MODIFY_SOURCES)
  74.     view.hideStep(STEP_REBOOT)
  75.     controler = DistUpgradeControler(view, datadir=data_dir)
  76.     controler.prepare()
  77.     controler.doPreUpgrade()
  78.     if controler.askDistUpgrade():
  79.       view.setStep(STEP_FETCH_INSTALL)
  80.       if not controler.doDistUpgrade():
  81.         sys.exit(1)
  82.       view.setStep(STEP_CLEANUP)
  83.       controler.doPostUpgrade()
  84.       view.information(_("Upgrade complete"),
  85.                        _("The upgrade was completed."))
  86.   else:
  87.     app = UpdateManager(data_dir)
  88.     app.main(options)
  89.